package com.zoe.app;

import cn.hutool.core.util.StrUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zbg
 * @date 2023/09/07
 * @description
 */
public class OperationUtil {
    public static final List<OperationOSEnum> list = new ArrayList<>();

    static {
        list.add(OperationOSEnum.WINDOWS);
        list.add(OperationOSEnum.ANDROID);
        list.add(OperationOSEnum.IOS);
    }

    public static String getOSName(String originalOs) {
        for (OperationOSEnum operationOSEnum : list) {
            String osNamePrefix = operationOSEnum.getOSName();
            if (StrUtil.startWith(originalOs, osNamePrefix)) {
                return operationOSEnum.getOSName();
            }
        }
        return OperationOSEnum.OTHER.getOSName();
    }

    public static void main(String[] args) {
        System.out.println(getOSName("Android"));
    }
}
